<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../common.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
    <head>        
    	<base href="<%=basePath%>">
        <!-- META SECTION -->
        <title>${htmlTitle}</title>            
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        
        <link rel="icon" href="favicon.ico" type="image/x-icon" />
        <!-- END META SECTION -->
    </head>
    <body>
    
    	<%@include file="../header.jsp"%>
    
        <!-- START PAGE CONTAINER -->
        <div class="page-container">
            
            <!-- START PAGE SIDEBAR -->
            	<%@include file="../left.jsp"%>
            <!-- END PAGE SIDEBAR -->
            
            <!-- PAGE CONTENT -->
            <div class="page-content">

                <!-- START BREADCRUMB -->
                <%=request.getAttribute("navigation") %> 
                <!-- END BREADCRUMB -->       
                
                <!-- START CONTENT FRAME -->
				<!-- END  CONTENT FRAME -->                
                
                <!-- PAGE CONTENT WRAPPER -->
                <div class="page-content-wrap">
					<div class="row">
						<div class="col-md-12" style="padding-top: 10px;">
							<form id="jvalidate" role="form" action="<%=basePath%>estate/saveOrUpdate" class="form-horizontal" method="post" enctype="multipart/form-data">
								<div class="panel panel-default">
									<div class="panel-body" style="border: none;">
									
										<input id="menuId" name="menuId" value="${currMenuId }" type="hidden" />
									
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												物业公司名称
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="id" name="id" value="${estate.id }" type="hidden" />
												<input id="name" name="name" value="${estate.name }" type="text" class="form-control" placeholder="请输入物业公司名称"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												法人代表
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="legalPerson" name="legalPerson" value="${estate.legalPerson }" type="text" class="form-control" placeholder="请输入法人代表"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												身份证号
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="cardNo" name="cardNo" value="${estate.cardNo }" type="text" class="form-control" placeholder="请输入身份证号"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												电话号码
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="tel" name="tel" value="${estate.tel }" type="text" class="form-control" placeholder="请输入电话号码"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												收款信息
											</label>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												收款人
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="owner" name="owner" value="${estate.owner }" type="text" class="form-control" placeholder="请输入收款人"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												收款银行
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="dueBank" name="dueBank" value="${estate.dueBank }" type="text" class="form-control" placeholder="请输入收款银行"/>
											</div>
										</div>
										
										<div class="form-group" >
											<label class="col-md-3 col-xs-12 control-label">
												收款分行
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="subbranch" name="subbranch" value="${estate.subbranch }" type="text" class="form-control" placeholder="请输入收款分行"/>
											</div>
										</div>
										
										<div class="form-group" >
											<label class="col-md-3 col-xs-12 control-label">
												银行卡号
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="account" name="account" value="${estate.account }" type="text" class="form-control" placeholder="请输入银行卡号"/>
											</div>
										</div>
										
										<div class="form-group" >
											<label class="col-md-3 col-xs-12 control-label">
												银行卡所在省份
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="prov" name="prov" value="${estate.prov }" type="text" class="form-control" placeholder="请输入银行卡所在省份"/>
											</div>
										</div>
										
										<div class="form-group" >
											<label class="col-md-3 col-xs-12 control-label">
												银行卡所在城市
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="city" name="city" value="${estate.city }" type="text" class="form-control" placeholder="请输入银行卡所在城市"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												对公/对私
											</label>
											<div class="col-md-6 col-xs-12">
												<input id="flag" name="flag" value="${estate.flag }" type="text" class="form-control" placeholder="请输入对私:00或者对公:00"/>
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												合同照片
											</label>
											<c:if test="${estate != null && estate.contractPic != null }">
												<div class="col-md-3 col-xs-6">
													<img alt="" src="${estate.contractPic}" width="200px;">
												</div>
											</c:if>
											<div class="col-md-6 col-xs-12">
												<input name="contractPicFile" id="contractPicFile" type="file" >
											</div>
										</div>
										
										<div class="form-group">
											<label class="col-md-3 col-xs-12 control-label">
												物业公司logo
											</label>
											<c:if test="${estate != null && estate.logo != null }">
												<div class="col-md-3 col-xs-6">
													<img alt="" src="${estate.logo}" width="200px;">
												</div>
											</c:if>
											<div class="col-md-6 col-xs-12">
												<input name="logoFile" id="logoFile" type="file" >
											</div>
										</div>
										
									</div>
									<div class="panel-footer pull-center"
										style="text-align: center">
										<button class="btn btn-primary" type="button" onclick="back()">
											取消
										</button>
										<button class="btn btn-primary"  type="submit" >
											<c:if test="${isUpdate == 0}">
												确认新增
											</c:if>
											<c:if test="${isUpdate == 1}">
												确认修改
											</c:if>
										</button>
									</div>
								</div>
							</form>
						</div>
					</div>
                </div>
                <!-- END PAGE CONTENT WRAPPER -->                                
            </div>            
            <!-- END PAGE CONTENT -->
        </div>
        <!-- END PAGE CONTAINER -->
        
        <script type="text/javascript">
        
        	$(document).ready(function() {
        		validate();
        		init();
			});
        	
        	function validate() {
        		var jvalidate = $("#jvalidate").validate({
	                ignore: [],
	                rules: {                                            
	                        name: {
	                                required: true
	                        },
	                        legalPerson: {
	                                required: true
	                        },
	                        cardNo: {
	                                required: true
	                        },
	                        tel: {
	                                required: true
	                        },
	                        owner: {
                                required: true
                        	},
                        	dueBank: {
                                required: true
                        	},
                        	subbranch: {
                                required: true
                        	},
                        	account: {
                                required: true
                        	},
                        	prov: {
                                required: true
                        	},
                        	city: {
                                required: true
                        	},
                        	flag: {
                                required: true
                        	}
	                    }                                        
	                });
        	}
        	
        	function init() {
        		var message = '${message}';
        		var saveOk = '${saveOk}';
        		if (null != message && undefined != message && '' != message) {
        			$("#info").html(message);
 			   		$("#infoModal").modal("show");
        		}
        		if (saveOk=="1") {
        			setTimeout(function () {
     					back();
                    }, 2000);
        		}
        	}
        	
        	function back(){
        		var menuId = '${currMenuId}';
	         	window.location = ctx +"/estate/list?menuId=" + menuId;
	        }
        </script>
    </body>
</html>